package main

import (
	"awesomeProject/Frontend"
	"awesomeProject/WebWeiXinLogin"
	"awesomeProject/AlibabaSMS"
	"fmt"
	"net/http"
)

func main() {
	fmt.Println("21212")
	http.HandleFunc("/api/go/sayHello", sayHello)
	http.HandleFunc("/api/go/WebWeiXinLogin",WebWeiXinLogin.WeiXinCode) //微信网页授权登录
	http.HandleFunc("/api/go/successful_registration",AlibabaSMS.Successful_registration) //发送报名成功短信 只能一个手机号 两个参数iphione何name
	http.HandleFunc("/api/go/verification_code",AlibabaSMS.Verification_code) // 发送短信验证码

	http.HandleFunc("/api/go/fron_get_class",Frontend.Fron_get_class) // 报名班级发送数组
	http.HandleFunc("/api/go/fron_get_is_exist",Frontend.Fron_get_is_exist) // 检查是否存在用户
	http.HandleFunc("/api/go/fron_set_register",Frontend.Fron_set_register) // 注册用户
	http.HandleFunc("/api/go/fron_set_up_register",Frontend.Fron_set_up_register) // 用户修改用户资料
	http.HandleFunc("/api/go/fron_get_class_list",Frontend.Fron_get_class_list) // 获取用户当前报名列表
	http.HandleFunc("/api/go/fron_get_user_id",Frontend.Fron_get_user_id) // 传入id获取用户信息
	http.HandleFunc("/api/go/fron_get_class_name",Frontend.Fron_get_class_name) // 传入id获取用户信息
	http.HandleFunc("/api/go/fron_get_register_record",Frontend.Fron_get_register_record) // 用户提交报名信息

	// admin
	http.HandleFunc("/api/go/admin_bm_login",Frontend.Admin_bm_login) // 用户提交报名信息
	http.HandleFunc("/api/go/admin_get_shenhe_class",Frontend.Admin_get_shenhe_class) // 获取带审核用户信息
	http.HandleFunc("/api/go/admin_up_register_record_statuok",Frontend.Admin_up_register_record_statuok) // 通过审核
	http.HandleFunc("/api/go/admin_up_register_record_statuno",Frontend.Admin_up_register_record_statuno) // 写入审核未通过
	http.HandleFunc("/api/go/admin_up_register_record_persons_curr_statuno",Frontend.Admin_up_register_record_persons_curr_statuno) // 写入审核未通过
	http.HandleFunc("/api/go/xls_derived",Frontend.Xls_derived) // 导出表格_用于短信表格
	http.HandleFunc("/api/go/xls_derived_beian",Frontend.Xls_derived_beian) // 导出表格_用于短信表格.
	http.HandleFunc("/api/go/delete_class_id",Frontend.Delete_class_id) // 删除报名记录表
	http.HandleFunc("/api/go/delete_class_ids_curr",Frontend.Delete_class_ids_curr) // 删除报名记录表
	http.HandleFunc("/api/go/delete_class_ids",Frontend.Delete_class_ids) // 删除报名记录表

	http.HandleFunc("/api/go/admin_upload_images", Frontend.UploadFileHandler_images) // 上传图片
	http.HandleFunc("/api/go/get_profession_course", Frontend.Get_profession_course) // 获取级联选择器

	http.HandleFunc("/api/go/admin_get_class", Frontend.Admin_get_class) // 获取班级信息
	http.HandleFunc("/api/go/admin_up_class", Frontend.Admin_up_class) // 获取班级信息
	http.HandleFunc("/api/go/admin_set_class", Frontend.Admin_set_class) // 插入班级信息
	http.HandleFunc("/api/go/admin_dele_class", Frontend.Admin_dele_class) // 删除班级信息

	http.HandleFunc("/api/go/admin_get_course", Frontend.Admin_get_course) // 获取班级信息
	http.HandleFunc("/api/go/admin_up_course", Frontend.Admin_up_course) // 获取班级信息
	http.HandleFunc("/api/go/admin_set_course", Frontend.Admin_set_course) // 插入班级信息
	http.HandleFunc("/api/go/admin_dele_course", Frontend.Admin_dele_course) // 删除班级信息

	http.HandleFunc("/api/go/admin_get_profession", Frontend.Admin_get_profession)
	http.HandleFunc("/api/go/admin_up_profession", Frontend.Admin_up_profession) // 获取班级信息
	http.HandleFunc("/api/go/admin_set_profession", Frontend.Admin_set_profession) // 插入班级信息
	http.HandleFunc("/api/go/admin_dele_profession", Frontend.Admin_dele_profession) // 删除班级信息

	http.HandleFunc("/api/go/admin_get_bm", Frontend.Admin_get_bm)
	http.HandleFunc("/api/go/admin_up_bm", Frontend.Admin_up_bm)

	Frontend.InitDB()
	http.ListenAndServe(":8089", nil)

	defer func() {
		Frontend.Cloce_Db()
	}()
}

func sayHello(w http.ResponseWriter, r *http.Request) {
	fmt.Fprintln(w, "Hello 沙河！")
}
